<?php
  
    session_start();

	include('functions.php');
	
	$congress = obtenerCongress($_SESSION['idcongress']);

	$bgcolor = $congress['BACKGROUND_COLOR'];

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

	<title><?php echo $congress['NAME']; ?></title>

	<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
	<link href="accordion/style.css" rel="stylesheet" type="text/css" media="screen" />

	<script src="accordion/accordian.pack.js" language="javascript" type="text/javascript">
	</script>

	<style>
		body {
			padding: 0px;
			margin: 0px;
		}
		
		.bodybg {
			background: <?php echo $bgcolor; ?>
			filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='<?php echo $bgcolor; ?>', endColorstr='#FFFFFF');
			background: -webkit-gradient(linear, left top, left bottom, from(<?php echo $bgcolor; ?>), to(#FFFFFF));
			background: -moz-linear-gradient(top,  <?php echo $bgcolor ?>,  #FFFFFF);
			width:100%;
			height: 600px;
		}
	</style>

</head>

<body>

	<div align="center" class="bodybg">

		<?php include('main_header.php'); ?>

		<?php include('botonera.php'); ?>
		
		<?php

			$search = getValor('search');
		
			if (getValor("advanced") == "advanced") {
		
				$search1 = getValor("search1");
				$option1 = getValor("option1");

				$condition2 = getValor("condition2");
				$search2 = getValor("search2");
				$option2 = getValor("option2");
				
				$condition3 = getValor("condition3");
				$search3 = getValor("search3");
				$option3 = getValor("option3");
				
				$condition4 = getValor("condition4");
				$search4 = getValor("search4");
				$option4 = getValor("option4");

				$abstracts = getAbstractsAdvanced($_SESSION['idcongress'], $search1, $option1, $condition2, $search2, $option2, 
													$condition3, $search3, $option3, $condition4, $search4, $option4);
				$cantAbstracts = getAbstractsAdvancedCount($_SESSION['idcongress'], $search1, $option1, $condition2, $search2, $option2, 
													$condition3, $search3, $option3, $condition4, $search4, $option4);

				
			} else {
				$abstracts = NULL;
				$cantAbstracts = 0;
			 
				$author = getValor('author');
				
				if (strlen($search) > 0) {
					if ($author != '') {
						$abstracts = obtenerAbstractsPorCongressYAuthor($_SESSION['idcongress'], $search);
						$cantAbstracts = obtenerCantidadAbstractsPorCongressYAuthor($_SESSION['idcongress'], $search);
						$search = '';
					} else {
						$abstracts = obtenerAbstractsPorCongressYNombre($_SESSION['idcongress'], $search);
						$cantAbstracts = obtenerCantidadAbstractsPorCongressYNombre($_SESSION['idcongress'], $search);
					}
				} else {
					$abstracts = obtenerAbstractsPorCongress($_SESSION['idcongress']);
					$cantAbstracts = obtenerCantidadAbstractsPorCongress($_SESSION['idcongress']);
				}
			}

		?>

		<?php include('abstract_header.php'); ?>
		
		<div id="basic-accordian">
					
			<?php  if ($cantAbstracts > 0) { ?>				
		
				<?php 
				
					$uncolor = "#FFFFFF";
					$otrocolor = "#F8F8F8";
					$bgcolortr = $uncolor;
				
				?>
		
				<?php while ($row_abstract = mysql_fetch_assoc($abstracts)) { ?>

					<?php if ($row_abstract['SHOW_ABSTRACT']) { ?>
	
						<table width="100%" cellpadding="4" cellspacing="0">
							<tr bgcolor="<?php echo $bgcolortr; ?>" style="height: 25px;">
								<td width="50" align="center">
									<?php  if ($row_abstract['SHOW_PROCEEDING']) { ?>
										<img src="images/icon_book.png" />
									<?php } ?>
								</td>
								<td>
									<a onclick="window.open('abstract_proceeding_viewer.php?idabstract=<?php echo $row_abstract['ID_ABSTRACT']; ?>', 
										'abstract_proceeding', 'location=0, status=0, scrollbars=1, width=800, height=700');" href="#">
										<?php echo $row_abstract['TITLE']; ?>
									</a>
								</td>
							</tr>									
						</table>
	
						<?php if ($bgcolortr == $uncolor) { $bgcolortr = $otrocolor; } else { $bgcolortr = $uncolor; } ?>
	
	
					<?php } ?>

				<?php } ?>

			<?php } ?>

		</div>
		
	</div>

</body>
</html>
